home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wtj208.zip / FRANTZ / TARGET / CCINIT.C next >
C/C++ Source or Header  |  1993-04-10  |  1KB  |  42 lines

  1. /* ------------------------------ CCINIT.C ---------------------------
  2.  *    DLL Initialisation and Finalization
  3.  * ---------------------------------------------------------------- */
  4.  
  5. #include <windows.h>
  6. #include "Target_.h"
  7.  
  8. /* -------------------------- LibMain -------------------------------
  9.  *    Function called when DLL is loaded, from asm entry point
  10.  *        - hinst is DLL's handle
  11.  *        - wDataSeg is DS segment
  12.  *        - cbHeapSize is HEAPSIZE as declared in .DEF file
  13.  *        - lpszCmdLine is command line
  14.  *        Returns        TRUE to accept loading
  15.  *                    FALSE to stop it
  16.  * ---------------------------------------------------------------- */
  17.  
  18. int CALLBACK LibMain (HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
  19. {
  20. WNDCLASS        wc;                    // Window class structure
  21. LRESULT CALLBACK TargetWndProc (HWND, unsigned, WORD, DWORD);
  22.  
  23.     hmodDLL = hinst;                // Global variable
  24.  
  25. // ---- Unlocks the Date segment (if LocalInit had been called)
  26.     UnlockData (0);
  27.  
  28. // ---- Registers class
  29.     wc.hCursor            = LoadCursor (NULL, IDC_CROSS);
  30.     wc.hIcon            = NULL;
  31.     wc.lpszMenuName        = NULL;
  32.     wc.lpszClassName    = TARGET_CLASSNAME;
  33.     wc.hbrBackground    = COLOR_WINDOW+1;
  34.     wc.hInstance        = hinst;
  35.     wc.style            = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
  36.     wc.lpfnWndProc        = TargetWndProc;
  37.     wc.cbClsExtra        = 0;
  38.     wc.cbWndExtra        = 8;        // xCur, yCur, fCapture, VBBmp
  39.  
  40.     return RegisterClass (&wc);        // Stops loading if failure
  41. }
  42.